Skip to content

Complete assessment tasks and fix bugs#233

Open
EthanG45 wants to merge 1 commit intoautomationExamples:mainfrom
EthanG45:assessment
Open

Complete assessment tasks and fix bugs#233
EthanG45 wants to merge 1 commit intoautomationExamples:mainfrom
EthanG45:assessment

Conversation

@EthanG45
Copy link
Copy Markdown

Summary

  • Fix pet schema bug: name type corrected from "integer" to "string" in schemas.py
  • Complete test_pet.py tests: extended test_find_by_status_200 with all statuses and schema validation, implemented test_get_by_id_404 with parameterized edge cases
  • Complete test_store.py test: implemented test_patch_order_by_id with a @pytest.fixture for order creation and Order schema validation
  • Add Order schema in schemas.py (optional task)
  • Fix app bugs: missing f-string prefix in findByStatus error message, PATCH handler setting status before validation
  • Fix mutable default argument in api_helpers.py
  • Add uv project setup with pyproject.toml and uv.lock

Bugs Found

  1. schemas.pyname property typed as "integer" instead of "string"
  2. app.py:101 — error message missing f prefix: 'Invalid pet status {status}'
  3. app.py PATCH handler — order['status'] was set before validating the status value, allowing invalid statuses to be written before the abort

Test Plan

  • All 7 tests pass (pytest -v)
  • Schema validation covers pet and order responses
  • Edge cases covered for 404 responses (nonexistent and negative IDs)
  • All pet statuses parameterized (available, pending, sold)

- Fix pet schema: name type from integer to string
- Extend test_find_by_status_200 with all statuses and assertions
- Implement test_get_by_id_404 with parameterized edge cases
- Implement test_patch_order_by_id with fixture for test data
- Add Order schema and validation
- Fix missing f-string in findByStatus error message
- Fix PATCH handler to validate status before mutation
- Fix mutable default argument in api_helpers
- Add uv project setup with pyproject.toml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant